﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Gavel.Common.Component.Extension;

namespace Gavel.Common.Component.Controls;

/// <summary>
/// 图标按钮
/// </summary>
public class IconButton : Button
{
    /// <summary>
    /// 静态构造绑定样式
    /// </summary>
    static IconButton() => DefaultStyleKeyProperty.OverrideDefaultStyle<IconButton>();

    /// <summary>
    /// 图标
    /// </summary>
    public static readonly DependencyProperty IconProperty = nameof(IconProperty).Register<IconButton, Geometry>();

    /// <summary>
    /// 图标
    /// </summary>
    public Geometry Icon
    {
        get => (Geometry)GetValue(IconProperty);
        set => SetValue(IconProperty, value);
    }

    /// <summary>
    /// 图标大小
    /// </summary>
    public static readonly DependencyProperty IconSizeProperty = nameof(IconSizeProperty).Register<IconButton, double>();

    /// <summary>
    /// 图标大小
    /// </summary>
    public double IconSize
    {
        get => (double)GetValue(IconSizeProperty);
        set => SetValue(IconSizeProperty, value);
    }

    /// <summary>
    /// 鼠标悬浮时的背景刷子
    /// </summary>
    public static readonly DependencyProperty BackgroundBrushHoverProperty = nameof(BackgroundBrushHoverProperty).Register<IconButton, Brush>();

    /// <summary>
    /// 鼠标悬浮时的背景刷子
    /// </summary>
    public Brush BackgroundBrushHover
    {
        get => (Brush)GetValue(BackgroundBrushHoverProperty);
        set => SetValue(BackgroundBrushHoverProperty, value);
    }

    /// <summary>
    /// 鼠标悬浮时的前景刷子
    /// </summary>
    public static readonly DependencyProperty ForegroundBrushHoverProperty = nameof(ForegroundBrushHoverProperty).Register<IconButton, Brush>();

    /// <summary>
    /// 鼠标悬浮时的前景刷子
    /// </summary>
    public Brush ForegroundBrushHover
    {
        get => (Brush)GetValue(ForegroundBrushHoverProperty);
        set => SetValue(ForegroundBrushHoverProperty, value);
    }
}